<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
		<meta name="HandheldFriendly" content="true"/>
		<meta name="MobileOptimized" content="320"/>
		<title>HTML5+ Runtime</title>
		<script type="text/javascript" src="js/common.js"></script>
		<script type="text/javascript" charset="utf-8">
// H5 plus事件处理
function plusReady(){
	var ev=document.getElementById('version');
	ev&&(ev.innerText=plus.runtime.version);
	plus.webview.currentWebview().show('zoom-fade-out');
	// 更新分享按钮
	plus.share.getServices(function(s){
		for(var i in s){
			shares[s[i].id]=s[i];
		}
	},function(e){
		console.log('updateShare failed: '+JSON.stringify(e));
	});
	// 在流应用环境下显示“创建桌面图标”
	if(navigator.userAgent.indexOf('StreamApp')>=0){
		shortcut.style.display='block';
	}
	// 设置窗口优化隐藏
	dragHide();
	// 初始化分享按钮
	shareBts.push({title:'微信朋友圈',id:'weixin',x:'WXSceneTimeline'});
	shareBts.push({title:'微信好友',id:'weixin',x:'WXSceneSession'});
	shareBts.push({title:'新浪微博',id:'sinaweibo'});
	shareBts.push({title:'QQ',id:'qq'});
	shareBts.push({title:'更多'});
}
document.addEventListener("plusready",plusReady,false);

// 判断是否为流应用环境
var bStream = navigator.userAgent.indexOf('StreamApp')>=0;

// 分享应用
var shares={},shareBts=[];
function share(){
	(shareBts.length>1)||('Android'!==plus.os.name&&shareBts.length>0)?plus.nativeUI.actionSheet({title:'分享"HelloH5"应用',cancel:'取消',buttons:shareBts},function(e){
		(e.index>0)&&shareAction(shareBts[e.index-1]);
	}):(shareBts.length>0?shareWithSystem():plus.nativeUI.alert('当前环境无法支持分享操作!'));
}
function shareAction(sb){
	var msg = {};
	switch(sb.id){
		case 'weixin':
			msg.type = 'web';
			msg.title='"HelloH5" - 使用HTML5+技术开发原生APP';
			msg.content='如果你有流应用引擎还能省流量秒装，快来体验吧';
			sb.x&&(msg.extra={scene:sb.x});
		break;
		case 'sinaweibo':
			msg.type = 'web';
			msg.content='"HelloH5" - 使用HTML5+技术开发原生APP，如果你有流应用引擎还能省流量秒装，快来体验吧';
		break;
		case 'qq':
			msg.type = 'txt';
			msg.title='"HelloH5" - 使用HTML5+技术开发原生APP，如果你有流应用引擎还能省流量秒装，快来体验吧';
		break;
		default:
		shareWithSystem();
		return;
		break;
	}
	if(!shares[sb.id]){
		plus.nativeUI.alert('当前环境不支持此分享!');
		return;
	}
	var s = shares[sb.id];
	msg.href=bStream?'http://m3w.cn/s/HelloH5?url=about&__streamapp':'http://www.dcloud.io/helloh5/';
	msg.thumbs=msg.pictures=['_www/icon.png'];
	s.authenticated?shareMessage(s,msg):s.authorize(function(){
		shareMessage(s,msg);
	},function(e){
		plus.nativeUI.toast('取消分享!');
	});
}
function shareMessage(s,m){
	s.send(m, function(){
		plus.nativeUI.toast('完成分享!');
	},function(e){
		plus.nativeUI.toast('取消分享!');
	});
}
function shareWithSystem(){
	plus.share.sendWithSystem?plus.share.sendWithSystem({
		content:'"HelloH5"使用HTML5+技术开发，如果你有流应用引擎还能省流量秒装，快来体验吧('+(bStream?'http://m3w.cn/s/HelloH5?__streamapp':'http://www.dcloud.io/streamapp/')+')',
		title:'HelloH5',
		href:bStream?'http://m3w.cn/s/HelloH5?__streamapp':'http://www.dcloud.io/streamapp/',
		pictures:('Android'==plus.os.name)?null:['_www/icon.png']
	}):shareWithSystemNativeJS();
}
function shareWithSystemNativeJS(){
	var main = plus.android.runtimeMainActivity(),
	Intent = plus.android.importClass('android.content.Intent'),
	File = plus.android.importClass('java.io.File'),
	Uri = plus.android.importClass('android.net.Uri');
	var intent=new Intent(Intent.ACTION_SEND),
	p=plus.io.convertLocalFileSystemURL('_www/icon.png'),
	f=new File(p),
	uri=Uri.fromFile(f);
	if(f.exists()&&f.isFile()){
		intent.setType('image/*');
		intent.putExtra(Intent.EXTRA_STREAM,uri);
	}else{
		intent.setType('text/plain');
	}
	intent.putExtra(Intent.EXTRA_SUBJECT,'HelloH5');
	intent.putExtra(Intent.EXTRA_TEXT,'"HelloH5"使用HTML5+技术开发，如果你有流应用引擎还能省流量秒装，快来体验吧('+(bStream?'http://m3w.cn/s/HelloH5?__streamapp':'http://www.dcloud.io/streamapp/')+')');
	intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
	main.startActivity(Intent.createChooser(intent,'分享"HelloH5"应用'));
}
function createShortcut(){
	plus.navigator.createShortcut({name:'HelloH5',icon:'icon.png'});
}
function dragHide(){
	var ws = plus.webview.currentWebview();
	// 窗口隐藏时调整到正确位置（drag操作会修改窗口位置），否则可能导致无法调用show方法显示
	ws.addEventListener('hide',function(){
		ws.setStyle({left:'0px'});
	},false);
	// 设置拖动关闭当前窗口
	ws.drag({direction:'right',moveMode:'followFinger'}, {view:plus.runtime.appid,moveMode:'silent'}, function(e){
		if(e.type=='end'&&e.result){
			ws.close();
		}
		console.log('Drag Event: '+JSON.stringify(e));
	});
}
		</script>
		<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8"/>
		<style type="text/css">
li {
	padding: 2em;
	border-bottom: 1px solid #eaeaea;
	background: #fafafa;
	font-size: 12px;
}
li:active {
	background: #f4f4f4;
}
footer {
	width: 100%;
	text-align: center;
	color: #c6c6c6;
	font-size: 12px;
}
		</style>
	</head>
	<body>
		<div class="logo">
			<br/>
			<img style="width:64px" src="icon.png"/><br/>
			<span style="font-size: 20px;">HTML5+ Runtime</span><br/>
			(v<span id="version">-.-.-</span>)<br/>
			<!--<img style="width:100%" src="img/qr.png"/>-->
			<div id="shortcut" style="display:none;" class="button" onclick="createShortcut()">创建桌面图标</div>
			<br/><br/>
		</div>
		<p class="des" style="font-size:16px;line-height:30px;margin: 0px .5em;">HTML5中国产业联盟，简称“HTML5+ 联盟”，是为了更好的推进HTML5的商用、更好的为HTML5开发者服务而由产业链主流厂商共同组成的一个联盟。<br/>
　　 HTML5+规范的愿景：根据开发者需求，为其提供增强的功能、性能扩展规范。方便开发者开发跨平台的app，并接近原生的功能和性能。
		</p>
		<br/>
		<ul style="list-style:none;margin:0;padding:0;text-align:left;">
			<li onclick="plus.runtime.openURL('http://weibo.com/html5plus');">
				<img style="width:40px;height:40px;vertical-align:middle;" src=""/>
				微博
			</li>
			<li onclick="plus.runtime.openURL('http://www.html5plus.org');">
				<img style="width:40px;height:40px;vertical-align:middle;" src=""/>
				http://www.html5plus.org
			</li>
			<li onclick="window.open('mailto:admin@html5plus.org');">
				<img style="width:40px;height:40px;vertical-align:middle;" src=""/>
				HTML5+规范不够用或有问题？请联系我们
			</li>
			<li style="border-bottom:0px;" onclick="plus.runtime.openWeb('https://ask.dcloud.net.cn/protocol.html');">
				<img style="width:40px;height:40px;vertical-align:middle;" src="data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAO+SURBVGiB7ZlNaF1FFMd/Z27TJiH1qy0KmoqiLegiyb03iviBHwvBZf1aCG5EcNMuxYILqbSgi7qIG0XcCNkr7hREyULDe3OTrESCLREtFGmNC1uTe+d0cd/DIL6578297Uts//B4zJtzZv7/+ThzZp6oKjsZZtgE6uKGgGFjxwvY1VRDWZbdpaofAc95zHJVPQ6cTpLENdFvIzNgrRVVfQU/eYBdIvK2iDzTRL/Q5wwsLi5ORFH0kDFmEhhVVeeca6Vpmm1pZ2+ffU6IyIFuYWFhwYyPjz8uIg+q6iZw0Riz6pxbieO4cpak6hxot9uTInJaVZ80xuwH6Pj8CLwRx/G3ANbaQ8AJ4H7gEqCAdL4V2ANEwLxz7sM0TTdWVlZG8jx/EzgqIrd32i1EZFVVv1TVE0mS/BksoNVq7RGRj0Xk1R4mc3EcH+sWlpeXb1bVWzrFfzccAfn09PQv3R+WlpbucM59D9z9X42r6klVfSdN07wXR+8SMsYcBF72mDybZdkTMzMz3wFMTU2tA+u+NreiKIrnReS2XvUickxEPgV+7mVTtQfupZz6Xh0cAj7LsmwOWAXGKEe6FxxQAM45NwO8jn/v7KVckmECVHWfiPjqAQ6KyClgg3LN93bouAGIyCh9REFV3eerrxIgPgFb7EaAkUrDAKiql0DVCGyHVNXLoUpA9fBffXg51EklHHAGuCQiuwP8CwBVPQDsDyVRR8DnwLvGmHVVHQ3wLzqfe4DjwFMhJIIFqOo3SZJk1ZaVWLXWPs21FiAiL1lrJ4BNwvdKAdwKHAnlUWcJPQY8TLkXQgVoh4Pv8POi7n3gqsT+QXB938hUdQ24QJkDDewObIjInYA3XfChjoCvnHNv5Xl+PoqiYAFRFN0nIu8BaQiJOgJ+mJ2dtTX8u1iz1mYMQcCL1trfVfU8cBODRyMBLohIArwQSqKOgMPA+yJSEB4MHOV9IziY1A2jITlQo7iuw6ijfJn4Cxjln1eIfpFTphKHgYlQEqECcuAD4BPgMuU6HnQTd7PRFDhFKWRghAoogK/jOP4p0H8r1qy1r3GN
BewGTrbb7UlV/YNyCYTMwN/GmEeARwN5BAsQIBWRORHZJCyp677YjTHEMDpGWB7UGP73rxLb4ZzwctgJM+B9YverM+a3ZrkMjk6y2BNVAs6IyK/NUhoIF0XkrM/AK8A5d05V5xulNABUdc4Yc9ZnU/kPTavVGgOOdN7qH6BG3tIPVPUcsAjMq+oXaZpe9tlXCtju2A5hshZuCBg2dryAK8/cRTPGl3SwAAAAAElFTkSuQmCC"/>
				用户协议和隐私政策
			</li>
		</ul>
		<br/>
		<footer>
			<span>Powered By DCloud</span>
			<br/>
			<span>HTML5+规范版权所有HTML5中国产业联盟</span>
			<br/>
			<!--<span>Copyright ©2012-2015</span>
			<br/>
			<span>数字天堂（北京）网络技术有限公司</span>-->
		</footer>
	</body>
</html>